using System;
using System.Collections.Generic;
using System.Text;
using NHibernate.Property;

namespace Technoera.Common.Nh.CustomPropertyAccessors
{
    public class SpecialCasePropertyAccessor : FieldAccessorBase
    {
        public SpecialCasePropertyAccessor()
            : base(new CamelCaseUnderscoreStrategy())
        {
        }

        public override IGetter GetGetter(Type theClass, string propertyName)
        {
            string fieldName = GetFieldName(propertyName);
            return new SpecialCaseFieldGetter(GetField(theClass, fieldName), theClass, fieldName);
        }

        public override ISetter GetSetter(Type theClass, string propertyName)
        {
            string fieldName = GetFieldName(propertyName);
            return new FieldSetter(GetField(theClass, fieldName), theClass, fieldName);
        }
    }
}
